import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class 拼数 {
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static Read in = new Read();
    public static String[] arr = new String[21];
    public static void main(String[] args) throws IOException {
        int n = in.nextInt();
        for (int i = 1; i <= n; i++) {
            arr[i] = in.next();
        }
        Arrays.sort(arr,1,n + 1,(s1,s2) -> {
            String a = s1 + s2;
            String b = s2 + s1;
            return b.compareTo(a);
        });
        for (int i = 1; i <= n; i++) {
            out.print(arr[i]);
        }
        out.close();
    }
    public static class Read { // 自定义快速读入
        StringTokenizer st = new StringTokenizer("");
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        String next() throws IOException {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(bf.readLine());
            }
            return st.nextToken();
        }

        String nextLine() throws IOException {
            return bf.readLine();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }
}
